#!/bin/bash

pid_file=run.pid

if [ -f ${pid_file} ];then
    run_pid=`cat ${pid_file}`
    if [ -z ${run_pid} ];then
        # pid=`ps -ef|grep 'python3 server.py'|awk '{print $2}'`
        # [ -z ${pid} ] || kill -9 ${pid}
        echo "not found pid!"
    else
        kill ${run_pid} &&  cat /dev/null > run.pid
        echo "already stop pid: ${run_pid} ......"
    fi
else
    # pid=`ps -ef|grep 'python3 server.py'|awk '{print $2}'`
    # [ -z ${pid} ] || kill -9 ${pid}
    echo "stop......"
fi
